import 'package:flutter/material.dart';

class settingAdd extends StatelessWidget {
  settingAdd({super.key});

  final GlobalKey<FormState> _formKey = GlobalKey<FormState>();

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 300,
      height: 500,
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(10),
      ),
      child: Form(
        key: _formKey,
        child: Column(crossAxisAlignment: CrossAxisAlignment.center, children: [
          Positioned(
                  top: 0,
                  child: Container(
                    width: 20,
                    height: 6,
                    decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(10),
                        color: Colors.grey),
                  )),
          Padding(
            padding: const EdgeInsets.only(bottom: 10, top: 20),
            child: TextFormField(
              decoration: const InputDecoration(
                labelText: "",
                alignLabelWithHint: true,
                contentPadding:
                    EdgeInsets.symmetric(vertical: 10.0, horizontal: 16.0),
                border: OutlineInputBorder(),
              ),
              onSaved: (value) {},
            ),
          ),
          Positioned(
            left: 0,
            right: 0,
            bottom: 10,
            child: Container(
              width: 100,
              height: 40,
              decoration: BoxDecoration(
                color: Colors.orange,
                borderRadius: BorderRadius.circular(10),
              ),
              alignment: Alignment.center,
              child: TextButton(
                  onPressed: () {
                    if (_formKey.currentState!.validate()) {
                      _formKey.currentState!.save();
                    }
                  },
                  child: const Text(
                    "添加",
                    style: TextStyle(color: Colors.white),
                  )),
            ),
          ),
        ]),
      ),
    );
  }
}
